************************BASE COVID-19******************
**********************INDEX GENERATOR******************


*Raw Policy Index for Miami Covid-19 Observatory*

gen Policy_Index= ((School_Closure+ Workplace_Closure+ Public_Events_Cancelled+ Public_Transit_Suspended+ Information_Campaign+ Internal_Travel_Control+ International_Travel_Controls+Rest_on_gatherings+Stay_at_home)/9)*100


*Adjustment for the number of days the policy has been in place*

gen indice_cierre_de_escuelas=School_Closure*(Days_Since_Schools_Closed/Days)*100
gen indice_suspencion_laboral=Workplace_Closure*(Days_Workplace_Closure/Days)*100
gen indice_cancelacion_eventos_pub=Public_Events_Cancelled*(Public_Events_Cancelled_Days/Days)*100
gen indice_suspension_transporte_pub=Public_Transit_Suspended*(Days_Since_Transit_Suspend/Days)*100
gen indice_campanas_informativas=Information_Campaign*(Information_Campaign_Days/Days)*100
gen indice_restriccion_viajes_estado=Internal_Travel_Control*(Days_Since_Internal_Travel_Ban/Days)*100
gen indice_control_viajes_interna=International_Travel_Controls*(Days_Since_International_Ban/Days)*100
gen indice_restrictedgatherings=Rest_on_gatherings*(Days_rest_on_gatherings/Days)*100
gen indice_masks=Use_face_masks*(Days_use_face_mask/Days)*100 
gen indice_stayhome=Stay_at_home*(Days_since_stay_at_home/Days)*100 


gen Policy_Index_Adjusted_Time=(indice_cierre_de_escuelas+indice_suspencion_laboral+indice_cancelacion_eventos_pub+indice_suspension_transporte_pub+indice_campanas_informativas+indice_restriccion_viajes_estado+indice_control_viajes_interna+indice_restrictedgatherings+indice_stayhome)/9



*generate nationally-weighted averages*

asgen index_natlweighedaverage = Policy_Index_Adjusted_Time, weights(population) by(Days)



